Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(db, webserver): Implement GitHubRepositoryProvider connect flow #1749

Merged
merged 18 commits into from
Apr 9, 2024

Conversation

boxbeam
Copy link
Contributor

@boxbeam boxbeam commented Apr 1, 2024

Relates to TAB-479

@boxbeam boxbeam requested a review from wsxiaoys April 1, 2024 19:56
Copy link

codecov bot commented Apr 1, 2024

Codecov Report

Attention: Patch coverage is 0% with 249 lines in your changes are missing coverage. Please review.

Project coverage is 53.11%. Comparing base (f628f5c) to head (7d69008).

Files Patch % Lines
ee/tabby-webserver/src/integrations/github.rs 0.00% 99 Missing ⚠️
ee/tabby-db/src/github_repository_provider.rs 0.00% 76 Missing ⚠️
...ebserver/src/service/github_repository_provider.rs 0.00% 38 Missing ⚠️
...webserver/src/schema/github_repository_provider.rs 0.00% 10 Missing ⚠️
ee/tabby-webserver/src/service/mod.rs 0.00% 8 Missing ⚠️
ee/tabby-webserver/src/schema/mod.rs 0.00% 7 Missing ⚠️
ee/tabby-webserver/src/service/dao.rs 0.00% 7 Missing ⚠️
ee/tabby-webserver/src/handler.rs 0.00% 4 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #1749      +/-   ##
==========================================
- Coverage   54.38%   53.11%   -1.28%     
==========================================
  Files         117      121       +4     
  Lines       10227    10476     +249     
==========================================
+ Hits         5562     5564       +2     
- Misses       4665     4912     +247     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

ee/tabby-db/migrations/0022_github-provider.up.sql Outdated Show resolved Hide resolved
ee/tabby-db/migrations/0022_github-provider.up.sql Outdated Show resolved Hide resolved
ee/tabby-db/migrations/0022_github-provider.up.sql Outdated Show resolved Hide resolved
ee/tabby-db/migrations/0022_github-provider.up.sql Outdated Show resolved Hide resolved
ee/tabby-db/src/github_provider.rs Outdated Show resolved Hide resolved
ee/tabby-db/src/github_provider.rs Outdated Show resolved Hide resolved
@wsxiaoys wsxiaoys marked this pull request as draft April 2, 2024 00:44
@boxbeam boxbeam marked this pull request as ready for review April 2, 2024 18:12
ee/tabby-db/src/github_repository_provider.rs Outdated Show resolved Hide resolved
ee/tabby-db/src/github_repository_provider.rs Outdated Show resolved Hide resolved
Cargo.lock Outdated Show resolved Hide resolved
@wsxiaoys wsxiaoys marked this pull request as draft April 3, 2024 00:47
@boxbeam boxbeam marked this pull request as ready for review April 3, 2024 18:20
@wsxiaoys wsxiaoys marked this pull request as draft April 4, 2024 01:43
@boxbeam boxbeam marked this pull request as ready for review April 4, 2024 17:36
@wsxiaoys wsxiaoys marked this pull request as draft April 5, 2024 05:31
@boxbeam boxbeam marked this pull request as ready for review April 5, 2024 21:27
@boxbeam boxbeam changed the title feat(db): Create github provider table and DAO feat(db): Implement GitHub Provider OAuth Flow Apr 9, 2024
@boxbeam boxbeam force-pushed the github-provider-db branch from ac4ba59 to 0623d09 Compare April 9, 2024 14:55
@@ -0,0 +1,2 @@
DROP TABLE github_repository_provider;
DROP TABLE github_provided_repositories;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

remove? BTW - can this type of error captured in unit test?

Copy link
Contributor Author

@boxbeam boxbeam Apr 9, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Already removed, and I'm not sure - we could have a CI tool which runs cargo sqlx db reset --source ee/tabby-db/migrations and then tries to de-migrate with cargo sqlx migrate revert, which should error if the down migration is invalid. I don't think a unit test could catch it, though.

ee/tabby-db/src/github_repository_provider.rs Outdated Show resolved Hide resolved
ee/tabby-webserver/src/handler.rs Outdated Show resolved Hide resolved
@wsxiaoys wsxiaoys marked this pull request as draft April 9, 2024 15:02
@boxbeam boxbeam force-pushed the github-provider-db branch from 284eb72 to 86d2973 Compare April 9, 2024 15:51
@boxbeam boxbeam marked this pull request as ready for review April 9, 2024 15:51
@wsxiaoys wsxiaoys changed the title feat(db): Implement GitHub Provider OAuth Flow feat(db): Implement GitHubRepositoryProvider integration flow Apr 9, 2024
@wsxiaoys wsxiaoys changed the title feat(db): Implement GitHubRepositoryProvider integration flow feat(db): Implement GitHubRepositoryProvider connect flow Apr 9, 2024
@boxbeam boxbeam force-pushed the github-provider-db branch from 0407350 to cc612aa Compare April 9, 2024 16:58
Copy link
Member

@wsxiaoys wsxiaoys left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Otherwise LG!

ee/tabby-webserver/src/integrations/github.rs Outdated Show resolved Hide resolved
ee/tabby-webserver/src/integrations/github.rs Outdated Show resolved Hide resolved
@wsxiaoys wsxiaoys changed the title feat(db): Implement GitHubRepositoryProvider connect flow feat(db, webserver): Implement GitHubRepositoryProvider connect flow Apr 9, 2024
@@ -226,6 +230,30 @@ impl Query {
.await
}

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

still need api for C/U/D? but it's fine to do it in a follow up PR

@wsxiaoys wsxiaoys enabled auto-merge (squash) April 9, 2024 17:36
Comment on lines +47 to +48

fn get_authorize_url(client_id: &str, redirect_uri: &str, id: &ID) -> Result<Url> {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
fn get_authorize_url(client_id: &str, redirect_uri: &str, id: &ID) -> Result<Url> {
// FIXME(boxbeam): refactoring the logic using `/oauth/github.rs`
fn get_authorize_url(client_id: &str, redirect_uri: &str, id: &ID) -> Result<Url> {

@wsxiaoys wsxiaoys merged commit ed25f4a into main Apr 9, 2024
6 of 8 checks passed
@wsxiaoys wsxiaoys deleted the github-provider-db branch April 9, 2024 17:40
Comment on lines +63 to +64

async fn exchange_access_token(
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
async fn exchange_access_token(
// FIXME(boxbeam): refactoring the logic using `/oauth/github.rs`
async fn exchange_access_token(

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants